ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Skylark_Adult Class Reference

#include <skylarks_all.h>

Inheritance diagram for Skylark_Adult:
Skylark_Base TAnimal TALMaSSObject Skylark_Female Skylark_Male

Public Member Functions

 Skylark_Adult (int x, int y, double size, int age, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual void ReInit (int x, int y, double size, int age, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual ~Skylark_Adult ()
 
virtual void CopyMyself (int a_sktype)
 
- Public Member Functions inherited from Skylark_Base
 Skylark_Base (int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual void ReInit (int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual double On_FoodSupply (double)
 
void AddStriglingMort (int lifestage)
 
virtual int WhatState ()
 
bool InSquare (rectangle R)
 
- Public Member Functions inherited from TAnimal
unsigned SupplyFarmOwnerRef ()
 
AnimalPosition SupplyPosition ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
virtual void KillThis ()
 
virtual void CopyMyself ()
 
void SetX (int a_x)
 
void SetY (int a_y)
 
 TAnimal (int x, int y, Landscape *L)
 
virtual void BeginStep (void)
 BeingStep behaviour - must be implemented in descendent classes. More...
 
virtual void Step (void)
 Step behaviour - must be implemented in descendent classes. More...
 
virtual void EndStep (void)
 EndStep behaviour - must be implemented in descendent classes. More...
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual void Dying ()
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
virtual bool OnFarmEvent (FarmToDo)
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 

Public Attributes

bool Paired
 
- Public Attributes inherited from Skylark_Base
double m_pesticide_accumulation
 
double m_pcide_conc
 
TTypesOfSkState m_CurrentSkState
 
int Age
 
double m_Size
 
int m_Born_x
 
int m_Born_y
 
int m_MyHome
 The vegetation type where the skylark was born. More...
 
SkTerritoriesm_OurTerritories
 
Skylark_Population_Managerm_OurPopulationManager
 

Protected Member Functions

virtual double RemoveEM (double food)
 
double GetVegHindrance (int PolyRef)
 
double GetWeatherHindrance ()
 
bool GetBadWeather ()
 Extreme weather conditions check. More...
 
- Protected Member Functions inherited from Skylark_Base
bool DailyMortality (int mort)
 
virtual void PesticideResponse ()
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Protected Attributes

int GoodWeather
 
bool BSuccess
 
double MyExtractEff
 
int m_pesticide_affected
 
skTerritory_struct MyTerritory
 
vector< APoint > * m_aTerrlist
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 
int m_Location_y
 
Landscapem_OurLandscape
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 

Constructor & Destructor Documentation

◆ Skylark_Adult()

Skylark_Adult::Skylark_Adult ( int  x,
int  y,
double  size,
int  age,
SkTerritories Terrs,
Landscape L,
Skylark_Population_Manager SPM,
int  bx,
int  by,
int  mh 
)
3678  : Skylark_Base(x, y, Terrs, L, SPM, bx, by, mh) {
3679  m_Size = size;
3680  Age = age;
3681  BSuccess = false;
3682  MyExtractEff = (0.90 + double(random(21) / 100.0)) * MeanExtractionRatePerMinute;
3683  GoodWeather = 0;
3684  Paired = false;
3685  MyTerritory.ref = -1;
3686  m_aTerrlist = new vector<APoint>;
3687  m_pesticide_affected = -1;
3688 }
int random(int a_range)
Definition: ALMaSS_CmdLine.cpp:142
double MyExtractEff
Definition: skylarks_all.h:741
bool Paired
Definition: skylarks_all.h:752
int GoodWeather
Definition: skylarks_all.h:739
bool BSuccess
Definition: skylarks_all.h:740
skTerritory_struct MyTerritory
Definition: skylarks_all.h:743
int m_pesticide_affected
Definition: skylarks_all.h:742
vector< APoint > * m_aTerrlist
Definition: skylarks_all.h:744
double m_Size
Definition: skylarks_all.h:596
int Age
Definition: skylarks_all.h:595
Skylark_Base(int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
Definition: skylarks_all.cpp:2435
int ref
Definition: skylarks_all.h:311
static double MeanExtractionRatePerMinute
Definition: skylarks_all.cpp:183

References Skylark_Base::Age, BSuccess, GoodWeather, m_aTerrlist, m_pesticide_affected, Skylark_Base::m_Size, MeanExtractionRatePerMinute, MyExtractEff, MyTerritory, Paired, random(), and skTerritory_struct::ref.

◆ ~Skylark_Adult()

Skylark_Adult::~Skylark_Adult ( )
virtual
3704  {
3705  delete m_aTerrlist;
3706 }

References m_aTerrlist.

Member Function Documentation

◆ CopyMyself()

void Skylark_Adult::CopyMyself ( int  a_sktype)
virtual
6792  {
6793  AdultSkylark_struct * aps;
6794  aps = new AdultSkylark_struct;
6795  aps->x = m_Location_x;
6796  aps->y = m_Location_y;
6797  aps->size = m_Size;
6798  aps->Terrs = m_OurTerritories;
6799  aps->L = m_OurLandscape;
6800  aps->sex = false;
6801  aps->age = 0;
6802  aps->bx = m_Born_x;
6803  aps->mh = m_MyHome;
6804  aps->by = m_Born_y;
6805  m_OurPopulationManager->CreateObjects( a_sktype, this, NULL, aps, -1 );
6806  // object will be destroyed by death state
6807  // but must let Dad know anyway
6808  delete aps;
6809 }
Definition: skylarks_all.h:251
double size
Definition: skylarks_all.h:253
bool sex
Definition: skylarks_all.h:254
int age
Definition: skylarks_all.h:255
Skylark_Population_Manager * m_OurPopulationManager
Definition: skylarks_all.h:603
int m_MyHome
The vegetation type where the skylark was born.
Definition: skylarks_all.h:600
int m_Born_y
Definition: skylarks_all.h:598
SkTerritories * m_OurTerritories
Definition: skylarks_all.h:602
int m_Born_x
Definition: skylarks_all.h:597
void CreateObjects(int ob_type, TAnimal *pTAo, void *null, Skylark_struct *data, int number)
Definition: skylarks_all.cpp:557
int bx
Definition: skylarks_all.h:200
Landscape * L
Definition: skylarks_all.h:203
int x
Definition: skylarks_all.h:198
SkTerritories * Terrs
Definition: skylarks_all.h:204
int y
Definition: skylarks_all.h:199
int mh
Definition: skylarks_all.h:202
int by
Definition: skylarks_all.h:201
int m_Location_y
Definition: PopulationManager.h:228
int m_Location_x
Definition: PopulationManager.h:225
Landscape * m_OurLandscape
Definition: PopulationManager.h:229

References AdultSkylark_struct::age, Skylark_struct::bx, Skylark_struct::by, Skylark_Population_Manager::CreateObjects(), Skylark_struct::L, Skylark_Base::m_Born_x, Skylark_Base::m_Born_y, TAnimal::m_Location_x, TAnimal::m_Location_y, Skylark_Base::m_MyHome, TAnimal::m_OurLandscape, Skylark_Base::m_OurPopulationManager, Skylark_Base::m_OurTerritories, Skylark_Base::m_Size, Skylark_struct::mh, AdultSkylark_struct::sex, AdultSkylark_struct::size, Skylark_struct::Terrs, Skylark_struct::x, and Skylark_struct::y.

Referenced by Skylark_Population_Manager::Catastrophe().

◆ GetBadWeather()

bool Skylark_Adult::GetBadWeather ( )
protected

◆ GetVegHindrance()

double Skylark_Adult::GetVegHindrance ( int  PolyRef)
protected
3760  {
3761 #ifdef __CJTDebug_5
3762  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
3763 #endif
3764  /* CJT Changed in favour of a function of veg density double veg_biomass = m_OurLandscape->SupplyVegBiomass(polyref);
3765  double veg_height = m_OurLandscape->SupplyVegHeight(polyref); int bio = (int)floor(0.5+veg_biomass/(VeryHighDensityVeg/
3766  double(HindranceBiomassCategories))); // 0-24, 25-49, 50-74,74-100 categories
3767  int hei=(int)floor(0.5+veg_height/(100.0/double(HindranceHeightCategories)));
3768  if (hei>HindranceHeightCategories-1) hei=HindranceHeightCategories-1;
3769  if (bio>HindranceBiomassCategories-1) bio=HindranceBiomassCategories-1; return VegHindrance[hei][bio]; */
3770  if ( m_OurLandscape->SupplyVegPatchy( polyref ) ) return 1.0;
3771  int veg_height = ( int )floor( 0.5 + m_OurLandscape->SupplyVegHeight( polyref ) );
3772  if ( veg_height < 26 ) return 1.0;
3773  int veg_dens = m_OurLandscape->SupplyVegDensity( polyref );
3774  // double vh = ( VegHindranceH[ veg_height ] * 2 + VegHindranceD[ veg_dens ] ) / 3.0;
3775  //double vh = (0.33*( DensityScore[ veg_dens ] + 2 * HeightScore[ ( int )veg_height ] ) * 0.33333333)+0.67;
3776  double vh = ( VegHindranceD[ veg_dens ] + 2 * VegHindranceH[ veg_height ] ) * 0.3333;
3777 #ifdef __TRAMLINES_ON
3778  // Tramlines affect the amount of veg hindrance only
3779  // vh must be increased by a factor corresponding to the tramline effect
3780  // IF USING SKLARK SCRAPES !
3781  if ( m_OurLandscape->SupplySkScrapes( polyref )) {
3782  vh += ( ( 1.0 - vh ) * cfg_tramline_foraging.value() );
3783  }
3784  else if ( m_OurLandscape->SupplyHasTramlines( polyref )) {
3785  vh += ( ( 1.0 - vh ) * cfg_tramline_foraging.value() );
3786  }
3787 #endif
3788  return vh;
3789 }
double value(void)
Definition: configurator.h:118
int SupplyVegDensity(int a_polyref)
Definition: landscape.h:975
double SupplyVegHeight(int a_polyref)
Definition: landscape.h:936
bool SupplySkScrapes(int a_polyref)
Definition: landscape.h:981
bool SupplyHasTramlines(int a_x, int a_y)
Definition: landscape.h:1252
bool SupplyVegPatchy(int a_polyref)
Definition: landscape.h:986
double VegHindranceD[111]
Definition: skylarks_all.cpp:217
CfgFloat cfg_tramline_foraging
double VegHindranceH[111]
Definition: skylarks_all.cpp:216

References cfg_tramline_foraging, TAnimal::m_OurLandscape, Landscape::SupplyHasTramlines(), Landscape::SupplySkScrapes(), Landscape::SupplyVegDensity(), Landscape::SupplyVegHeight(), Landscape::SupplyVegPatchy(), CfgFloat::value(), VegHindranceD, and VegHindranceH.

Referenced by Skylark_Male::GetFood().

◆ GetWeatherHindrance()

double Skylark_Adult::GetWeatherHindrance ( )
protected
3740  {
3741 #ifdef __CJTDebug_5
3742  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
3743 #endif
3744  double hind;
3745  int rain = (int) m_OurLandscape->SupplyRain()/2;
3746  // Assume half of this falls at night
3747  // Make sure the indices remain in bounds
3748  if ( rain > 10 ) rain = 10;
3749  int temp = (int) (floor( 0.5 + m_OurLandscape->SupplyTemp() ));
3750  if ( temp < 0 ) temp = 0;
3751  if ( temp > 20 ) temp = 20;
3752  hind = RainHindrance[rain];
3753  hind *= TempHindrance[ temp ];
3754  return hind;
3755 }
double SupplyTemp(void)
Definition: landscape.h:1386
double SupplyRain(void)
Definition: landscape.h:1365
double TempHindrance[31]
Definition: skylarks_all.cpp:215
double RainHindrance[21]
Definition: skylarks_all.cpp:214

References TAnimal::m_OurLandscape, RainHindrance, Landscape::SupplyRain(), Landscape::SupplyTemp(), and TempHindrance.

Referenced by Skylark_Male::GetFood().

◆ ReInit()

void Skylark_Adult::ReInit ( int  x,
int  y,
double  size,
int  age,
SkTerritories Terrs,
Landscape L,
Skylark_Population_Manager SPM,
int  bx,
int  by,
int  mh 
)
virtual

Reimplemented in Skylark_Male, and Skylark_Female.

3690  {
3691  Skylark_Base::ReInit(x, y, Terrs, L, SPM, bx, by, mh);
3692  m_Size = size;
3693  Age = age;
3694  BSuccess = false;
3695  MyExtractEff = (0.90 + double(random(21) / 100.0)) * MeanExtractionRatePerMinute;
3696  GoodWeather = 0;
3697  Paired = false;
3698  MyTerritory.ref = -1;
3699  m_aTerrlist = new vector<APoint>;
3700  m_pesticide_affected = -1;
3701 }
virtual void ReInit(int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
Definition: skylarks_all.cpp:2449

References Skylark_Base::Age, BSuccess, GoodWeather, m_aTerrlist, m_pesticide_affected, Skylark_Base::m_Size, MeanExtractionRatePerMinute, MyExtractEff, MyTerritory, Paired, random(), skTerritory_struct::ref, and Skylark_Base::ReInit().

Referenced by Skylark_Female::ReInit(), and Skylark_Male::ReInit().

◆ RemoveEM()

double Skylark_Adult::RemoveEM ( double  food)
protectedvirtual
3717  {
3718 #ifdef __CJTDebug_5
3719  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
3720 #endif
3721  // remove metabolic requirements
3722  double used = m_OurPopulationManager->SupplyEMi();
3723 #ifdef __PESTICIDE_RA_ADULT
3724  // If using pesticide risk assessment then the total mg of pesticide collected that day are now in m_pcide
3725  // But, there well be more than we wanted, so now we take a mean as mg/kcal resource
3726  m_pcide_conc = m_pcide/food;
3727  // Note there is an assumption here that they only eat insects. We know this to be incorrect so depending upon the
3728  // aim of the assessment the line below may need to be modified (e.g. by scaling by the relative calorific content of
3729  // insects compared to plant matter.
3731 #endif
3732  food -=used;
3733  if ( food < 0 ) food = 0;
3734  return food; // Food still in gdw insects
3735 }
double m_pcide_conc
Definition: skylarks_all.h:593
double m_pesticide_accumulation
Definition: skylarks_all.h:592
double SupplyEMi()
Definition: skylarks_all.h:558

References Skylark_Base::m_OurPopulationManager, Skylark_Base::m_pcide_conc, Skylark_Base::m_pesticide_accumulation, and Skylark_Population_Manager::SupplyEMi().

Referenced by Skylark_Female::FeedYoung(), Skylark_Male::st_CaringForYoung(), and Skylark_Female::st_PreparingForBreeding().

Member Data Documentation

◆ BSuccess

◆ GoodWeather

◆ m_aTerrlist

◆ m_pesticide_affected

◆ MyExtractEff

double Skylark_Adult::MyExtractEff
protected

◆ MyTerritory

◆ Paired


The documentation for this class was generated from the following files: